<script type="text/javascript"> 
 function getSelectedStd()
 {
    var tbPosition = document.getElementById('tb_StdListBySession');
        var lastRow = tbPosition.rows.length - 1;
        var i;
        var student_id="";

        for (i=1; i<=lastRow; i++)
           {
              if(document.getElementById("chk_"+i).checked)
               {
            	student_id+=document.getElementById("student_id"+i).value+",";
               }
           }
           
   if(navigator.appName=="Netscape")
   {
    
     opener.insertStudents(student_id);
     onCloseAnimation(window.height,window.width);
   }
   else
    {
      window.opener.insertStudents(student_id);
      window.close()
    }
 }

var browser=navigator.appName;
function onCloseAnimation(h,w)
{
	for (var i = 1; i < 100; i++)
	{
		
		window.moveTo(60+i*5,60+i*5);
 		window.resizeTo( 500-i*15,500-i*15 );		
 		
 	}
 	
 	window.close();
}

//*************************************
function CheckAll()
{
 		var tbPosition = document.getElementById('tb_StdListBySession');
       var lastRow = tbPosition.rows.length - 1;
       var i;
       if(document.getElementById("chk_Com").checked)
       {
       for (i=1; i<=lastRow; i++)
         {          
           document.getElementById("chk_"+i).checked=true;
         }
      }
      else
      {
       for (i=1; i<=lastRow; i++)
         {          
           document.getElementById("chk_"+i).checked=false;
         }
     
      }
}
//*******************************
	/////////////////////////////////////////////////////////////////////////////	    
</script>
<div class="container top">

          <table id="tb_StdListBySession" class="globaltable globaltable-striped globaltable-bordered globaltable-condensed">
            <thead>
              <tr>
                <th class="header">
                <input type="checkbox" id="chk_Com" name="chk_Com" onclick="CheckAll()" />
                </th>
                <th class="yellow header headerSortDown">Roll No</th>
                <th class="green header">Name</th>
                <th class="red header">Feather's Name</th>
                <th class="red header">Mother's Name</th>
                <th class="red header">DOB</th>
                <th class="red header">Religion</th>
                <th class="red header">Blood G.</th>
              </tr>
            </thead>
            <tbody>
            <?php
             $ind=0;
             foreach($students as $row)
              {
              	$ind++;
                echo '<tr>'; 
                echo '<td><input type="checkbox" id="chk_'.$ind.'" name="chk_'.$ind.'"></td>';
                echo '<td>'.$row['student_id'].'
        		<input type="hidden" id="student_id'.$ind.'" name="student_id'.$ind.'" value="'.$row['student_id'].'"/></td>';
                echo '<td>'.$row['student_name'].'</td>';
                echo '<td>'.$row['fathername'].'</td>';
                echo '<td>'.$row['mothername'].'</td>';
                echo '<td>'.$row['dob'].'</td>';
                echo '<td>'.$row['religion'].'</td>';
                echo '<td>'.$row['bloodgroup'].'</td>';
               
                echo '</tr>';
              }
              ?>      
            </tbody>
          </table>
           <input type="button" value="Add Student" class="btn btn-info" onclick="getSelectedStd()"/>
          <?php echo '<div class="pagination">'.$this->pagination->create_links().'</div>'; ?>

      </div>
    </div>